Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Excel format support #156

Merged
merged 6 commits into from
Feb 11, 2024
Merged

Conversation

gorkavp
Copy link
Contributor

@gorkavp gorkavp commented Feb 7, 2024

This pull request adds support for generating Excel files as an output format in addition to the existing formats (html, csv, md, json, dot, sqlite). The changes include adding a new ExcelOutput constant, updating the OutputOptions struct to include ExcelOptions, and implementing the ExcelFormatter struct and its methods for formatting the data into an Excel file.

Copy link

codeclimate bot commented Feb 8, 2024

Code Climate has analyzed commit 44ed13b and detected 0 issues on this pull request.

View more on Code Climate.

Copy link
Owner

@vdjagilev vdjagilev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋
thanks for making this change, really cool. I've left couple of comments about it, otherwise it's ok.


// Set the column headers
file.SetCellValue(sheetName, "A1", "IP/Host")
file.SetCellValue(sheetName, "B1", "Servicios")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Services?

}

// Save the Excel file
err = file.SaveAs("nmap-output.xlsx")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a Writer that we use for output (by default it's stdout), I think we can use this https://xuri.me/excelize/en/utils.html#FileWriter

file.Write(f.config.Writer, /* some opts */)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the options though

```

All other options can be found on [Installation Wiki page](https://github.com/vdjagilev/nmap-formatter/wiki/Installation).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 I think people should be able to visit the wiki installation just by clicking, not sure why we are removing this.

@vdjagilev vdjagilev added priority/medium Medium priority issue tech/go Golang type/feature New feature (or request) labels Feb 8, 2024
Copy link

codecov bot commented Feb 8, 2024

Codecov Report

Attention: 36 lines in your changes are missing coverage. Please review.

Comparison is base (1c26b70) 81.79% compared to head (44ed13b) 77.74%.

Files Patch % Lines
formatter/formatter_excel.go 0.00% 33 Missing ⚠️
formatter/formatter.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #156      +/-   ##
==========================================
- Coverage   81.79%   77.74%   -4.05%     
==========================================
  Files          20       21       +1     
  Lines         692      728      +36     
==========================================
  Hits          566      566              
- Misses         79      115      +36     
  Partials       47       47              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vdjagilev
Copy link
Owner

Linter also reported some issues here: https://github.com/vdjagilev/nmap-formatter/pull/156/files#annotation_17863585109
Just if err != nil stuff

@vdjagilev vdjagilev changed the base branch from main to v3-dev February 10, 2024 12:43
@vdjagilev vdjagilev changed the base branch from v3-dev to feat/excel-support February 10, 2024 12:49
@vdjagilev
Copy link
Owner

I will merge it into development branch, there I can add some more unit tests and fix linter mistakes

@vdjagilev vdjagilev merged commit 77d8074 into vdjagilev:feat/excel-support Feb 11, 2024
7 of 10 checks passed
vdjagilev added a commit that referenced this pull request Feb 23, 2024
* Add Excel format support (#156)

* Excel format support added

* fix issuses

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* tweak: ci: fix branch trigger name

* tweak: err check

* chore: refactor writing headers

* chore: minor warning fixes

* chore: ci: update versions

* refactor: split into smaller functions

* tweak: excel: column width

* tweak: excel: cosmetic text wrapping

* tweak: excel: ip-addr & hostname text cosmetic improvements

* tests: implement basic unit tests

* tweak: linter fixes

* tests: increase validation coverage

* tests: coverage: output file

* tests: excel: more test cases

* tests: excel: bigger coverage

---------

Co-authored-by: Gorka <72318822+gorkavp@users.noreply.github.com>
vdjagilev added a commit that referenced this pull request Jun 2, 2024
* Add Excel format support (#156)

* Excel format support added

* fix issuses

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* tweak: ci: fix branch trigger name

* tweak: err check

* chore: refactor writing headers

* chore: minor warning fixes

* chore: ci: update versions

* refactor: split into smaller functions

* tweak: excel: column width

* tweak: excel: cosmetic text wrapping

* tweak: excel: ip-addr & hostname text cosmetic improvements

* tests: implement basic unit tests

* tweak: linter fixes

* tests: increase validation coverage

* tests: coverage: output file

* tests: excel: more test cases

* tests: excel: bigger coverage

---------

Co-authored-by: Gorka <72318822+gorkavp@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/medium Medium priority issue tech/excel tech/go Golang type/feature New feature (or request)
Projects
Status: Released / Merged
Development

Successfully merging this pull request may close these issues.

2 participants